using System;
using System.Collections.Generic;
using System.Text;
using SAGE.Agent;

namespace SAGE.Utilities
{
  public class CollisionEngine
  {
    public static Collision CheckCollisions(IInteractorAgent agent, World world)
    {
      if (agent.Location.z - agent.Offset.z <= world.BoundingBox.GetBounds().zmin ||
          agent.Location.z + agent.Offset.z >= world.BoundingBox.GetBounds().zmax)
      {
        return new Collision(CollisionAxis.Z);
      }
      else if (agent.Location.x - agent.Offset.x <= world.BoundingBox.GetBounds().xmin ||
               agent.Location.x + agent.Offset.x >= world.BoundingBox.GetBounds().xmax)
      {
        return new Collision(CollisionAxis.X);
      }
      else if (agent.Location.y - agent.Offset.y <= world.BoundingBox.GetBounds().ymin ||
               agent.Location.y + agent.Offset.y >= world.BoundingBox.GetBounds().ymax)
      {
        return new Collision(CollisionAxis.Y);
      }
      return new Collision(CollisionAxis.None);;
    }
  }
}
